package unit1;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

public class IncludeClassTest {
    public static void main(String[] args) {
        System.out.println("1.pi/5的正弦值:"+Math.sin(Math.PI/5));//pi/5的正弦值
        System.out.println("2.1000的平方根："+Math.sqrt(1000));//1000的平方根
        System.out.println("3.2的十次方："+Math.pow(2,10));//2的10次方
        System.out.println("4.100.9的向下取整："+Math.floor(100.9));//100.9的向下取整
        System.out.println("5.100.1的向上取整："+Math.ceil(100.1));//100.1的向上取整
        System.out.println("6.100.4的四舍五入取整："+Math.round(100.4));//100.4的四舍五入取整
        System.out.println("7.100.5的四舍五入取整："+Math.round(100.5)+"\n");//100.5的四舍五入取整

        StringBuffer sb=new StringBuffer("abcdefgHIJKLMN");
        System.out.println("8(1).原字符为："+sb);//输出
        System.out.println("8(2).原字符长度为："+sb.length());//长度
        sb.insert(1,"M");//在第一位插入M
        System.out.println("8(3).在第一位加M："+sb);
        sb.insert(2,"N");//在第一位插入N
        System.out.println("8(4).在M和B加N："+sb);
        sb.delete(13,14);//删除L
        System.out.println("8(5).删除L："+sb);

        sb.delete(13,15);//删除L
        StringBuffer sd=new StringBuffer("MN");
        sd.reverse();
        sb.append(sd);
        System.out.println("8(6).最后的MN反向："+sb+"\n");

        DateFormat sj=DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG, Locale.CHINA);
        System.out.println("9.当前时间为："+sj.format(new Date())+"\n");

        System.out.println("10.");
        Calendar rq= Calendar.getInstance();
        Calendar future = Calendar.getInstance();
        SimpleDateFormat gs=new SimpleDateFormat("yyyy年MM月dd日\tEEEE");
        future.set(Calendar.YEAR, 2030);
        while (future.after(rq)){
            if(rq.get(Calendar.DAY_OF_WEEK)==Calendar.MONDAY){
                Date shuchu=rq.getTime();
                System.out.println(gs.format(shuchu));
            }
            rq.add(Calendar.MONTH,1);
        }
    }
}
